﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MODEL;
using DAL;

namespace BLL
{
    public class ubll
    {
        private ubll()
        {

        }
        private static ubll bll;
        private static readonly object obj = new object();
        public static ubll getbll()
        {
            if(bll==null)
            {
                lock (obj)
                {
                    if (bll == null)
                    {
                        bll = new ubll();
                    }
                    return bll;
                }


            }
            return bll;

        }
        /// <summary>
        /// 用户注册
        /// </summary>
        /// <param name="u"></param>
        /// <returns></returns>
        public int regist(uinfor u)
        {
            return udal.getdal().regist(u);
        }
        /// <summary>
        /// 判断用户名是否已存在
        /// </summary>
        /// <param name="uname"></param>
        /// <returns></returns>
        public int isregist(string uname)
        {
            return udal.getdal().isregist(uname);
        }
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="uname"></param>
        /// <param name="upwd"></param>
        /// <returns></returns>
        public int login(string uname, string upwd)
        {
            return udal.getdal().login(uname, upwd);
        }
        /// <summary>
        /// 判断登录人的角色
        /// </summary>
        /// <param name="uname"></param>
        /// <returns></returns>
        public string selrole(string uname)
        {
            return udal.getdal().selrole(uname);
        }
        /// <summary>
        /// 显示登录人的权限
        /// </summary>
        /// <param name="rname"></param>
        /// <returns></returns>
        public List<uinfor> showquanxian(string rname)
        {
            return udal.getdal().showquanxian(rname);
        }
      
            /// <summary>
            /// 添加挂号记录表
            /// </summary>
            udal dal = udal.getdal();
        public int ADDregister(uinfor u)
        {
            return dal.ADDregister(u);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int DELETEregister(int id)
        {
            return dal.DELETEregister(id);
        }
        /// <summary>
        /// 显示医院信息
        /// </summary>
        /// <returns></returns>
        public List<uinfor> showDoctor()
        {
            return dal.showDoctor();
        }
        /// <summary>
        /// 显示挂号记录表
        /// </summary>
        /// <returns></returns>
        public List<uinfor> show()
        {
            return dal.show();
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="u"></param>
        /// <returns></returns>
        public int UPDregister(uinfor u)
        {
            return dal.UPDregister(u);
        }
        /// <summary>
        /// 用户与专家交流显示
        /// </summary>
        /// <returns></returns>
        public List<uinfor> Showurealation()
        {
            return udal.getdal().Showurealation();
        }

        /// <summary>
        /// 用户专家关系表添加
        /// </summary>
        /// <returns></returns>
        public int Addurealation(uinfor add)
        {
            return udal.getdal().Addurealation(add);
        }
        //[ActionName("chaxun")]
        //[HttpGet]
        /// <summary>
        /// 查询科室专家
        /// </summary>
        /// <param name="zid"></param>
        /// <returns></returns>
        public List<uinfor> chaxunkeshi(int zid)
        {
            return udal.getdal().chaxunkeshi(zid);
        }
        //[ActionName("typelist")]
        //[HttpGet]
        /// <summary>
        /// 二级联动
        /// </summary>
        /// <param name="zid"></param>
        /// <returns></returns>
        public List<uinfor> typelist(int zid)
        {
            return ubll.getbll().typelist(zid);
        }

        ////挂号添加
        //[ActionName("addinfoGH")]
        //[HttpPost]
        public int addinfoGH(uinfor m)
        {
            return ubll.getbll().addinfoGH(m);
        }
        //[ActionName("showinfom")]
        //[HttpGet]
        public List<uinfor> showinfom()
        {
            return ubll.getbll().showinfom();
        }
    }
}
